<?php  


 //mysql 抽象工厂
class Mysql{}

interface Factory{
	public static function getDB();
}
//mysql 抽象工厂
class MysqlFactory implements Factory{
	public static function getDB(){
		return new Mysql();
	}	
}
class SqliteFactory implements Factory{
	public static function getDB(){
		return new Sqlite();
	}
}class MyPDOFacory implements Factory{
	public static function getDB(){
		return new MyPDo();
	}
}
 
//调用
$fact ='MysqlFactory';
$db =MysqlFactory::getDB();
print_r($db);

?>  